package www.wen.com.common.lib.util;

import android.app.ProgressDialog;
import android.content.Context;
import android.view.Gravity;

public class ProgressDialogUtil {

    private static ProgressDialog mProgressDialog = null;

    public static void initProgressDialog(Context context, String Title, String Message){
        mProgressDialog = new ProgressDialog(context, ProgressDialog.THEME_DEVICE_DEFAULT_LIGHT);

        mProgressDialog.setTitle(Title);
        mProgressDialog.setMessage(Message);
//        mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        mProgressDialog.setCancelable(false);
        mProgressDialog.setCanceledOnTouchOutside(false);
        mProgressDialog.getWindow().setGravity(Gravity.CENTER);
    }

    public static void showProgressDialog(){
        mProgressDialog.show();
    }

    public static void setMessage(String msg){
        mProgressDialog.setMessage(msg);
    }

    public static void dismissProgressDialog(){
        if(mProgressDialog != null && mProgressDialog.isShowing())
            mProgressDialog.dismiss();
    }

}
